package sort

object ImplicitValue {

  implicit val KeyOrdering = new Ordering[(BigDecimal, Long)] {
    override def compare(x: (BigDecimal, Long), y: (BigDecimal, Long)): Int = {
      if (x._1 != y._1) {
        val decimal = x._1 - y._1
        if (decimal > 0) 1 else -1
      } else {
        val l = x._2 - y._2
        if (l > 0) -1 else if (l < 0) 1 else 0
      }
    }
  }

}
